<?php
namespace app\wxapp\controller;


class Event 
{
    public function index(){
        //获取授权码
        $id= input('id');
        
        //验证授权码是否存在，存在返回赛事信息
        if($result = db('event')->where('id',$id)->find()){
            $data['state']        = 1;
            $result['begin_time'] = date('Y-m-d',strtotime($result['begin_time']));
            $result['end_time']   = date('Y-m-d',strtotime($result['end_time']));
            $data['event_info']   = $result; //赛事id
            
        }else{
            $data['state'] = 0;
            $data['info']  = '数据为空';
        }
        return json($data);
    }

}
